﻿//using Sgr.EventBus.RelayBoxs.Domain;

//namespace Sgr.EventBus.RelayBoxs.Storage
//{
//    public interface IOutboxMessageStorage
//    {
//        /// <summary>
//        /// 保存消息到存储
//        /// </summary>
//        Task InsertAsync(OutboxMessage message, CancellationToken cancellationToken = default);

//        /// <summary>
//        /// 获取待发送的消息列表
//        /// </summary>
//        Task<IEnumerable<OutboxMessage>> GetPendingMessagesAsync(int limit, CancellationToken cancellationToken = default);

//        /// <summary>
//        /// 标记为已发送
//        /// </summary>
//        Task MarkDispatchedAsync(IEnumerable<long> messageIds, CancellationToken cancellationToken = default);

//        /// <summary>
//        /// 标记为发送失败
//        /// </summary>
//        Task MarkFailedAsync(long messageId, string lastError = "", CancellationToken cancellationToken = default);

//        /// <summary>
//        /// 增加重试计数（Dispatcher 用）
//        /// </summary>
//        Task MarkRetryAsync(long messageId, DateTime nextOnUtc, string lastError = "", CancellationToken cancellationToken = default);

//        /// <summary>
//        /// 清理已成功投递且超过保留期限的消息。
//        /// </summary>
//        /// <param name="olderThanUtc">早于该时间点的成功消息将被清理</param>
//        /// <param name="max">单次清理的记录最大条数</param>
//        /// <param name="cancellationToken">取消令牌</param>
//        /// <returns>实际清理的条数</returns>
//        Task<int> CleanupDispatchedMessagesAsync(DateTime olderThanUtc, int max, CancellationToken cancellationToken = default);

//        /// <summary>
//        /// 清理已失败且超过最大重试次数（或失败时间过久）的消息。
//        /// </summary>
//        /// <param name="olderThanUtc">早于该时间点的失败消息将被清理</param>
//        /// <param name="max">单次清理的记录最大条数</param>
//        /// <param name="cancellationToken">取消令牌</param>
//        /// <returns>实际清理的条数</returns>
//        Task<int> CleanupFailedMessagesAsync(DateTime olderThanUtc, int max, CancellationToken cancellationToken = default);
//    }
//}